import request from '@/utils/request'
export function contrast(cmFlag, clusterFlag, createDate, queryFlag, cmFlag2, clusterFlag2, createDate2, queryFlag2) {
  return request({
    url: 'monitor_api/cmServiceParam/compareServiceParam?cmFlag=' + cmFlag + '&clusterFlag=' + clusterFlag + '&createDate=' + createDate + '&queryFlag=' + queryFlag + '&cmFlag2=' + cmFlag2 + '&clusterFlag2=' + clusterFlag2 + '&createDate2=' + createDate2 + '&queryFlag2=' + queryFlag2,
    method: 'get'
  })
}

export function param(cmFlag, clusterFlag, createDate, queryFlag, serviceType) {
  return request({
    url: 'monitor_api/cmServiceParam/selServiceParam?cmFlag=' + cmFlag + '&clusterFlag=' + clusterFlag + '&createTime=' + createDate + '&queryFlag=' + queryFlag + '&serviceType=' + serviceType,
    method: 'get'
  })
}

export function saveLine(data) {
  return request({
    url: 'monitor_api/cmServiceParam/saveBaseLine',
    method: 'post',
    data: data
  })
}

export function getService(cmFlag, clusterFlag, createTime) {
  return request({
    url: 'monitor_api/cmServiceParam/selServiceType?cmFlag=' + cmFlag + '&clusterFlag=' + clusterFlag + '&createDate=' + createTime,
    method: 'get'
  })
}

export function cluster() {
  return request({
    url: 'api/applicationQueue/cluster',
    method: 'get'
  })
}

export function getChildren(cmFlag) {
  return request({
    url: 'api/table/watermark/cluster/component?cmFlag=' + cmFlag,
    method: 'get'
  })
}

export function getVersion(cmFlag, clusterFlag) {
  return request({
    url: 'monitor_api/cmServiceParam/selAllVersion?cmFlag=' + cmFlag + '&clusterFlag=' + clusterFlag,
    method: 'get'
  })
}

export function getTarget(cmFlag, clusterFlag) {
  return request({
    url: 'monitor_api/cmTarget/selClusterServiceTarget?cmFlag=' + cmFlag + '&clusterFlag=' + clusterFlag,
    method: 'get'
  })
}

export function getTable(cmFlag, clusterFlag) {
  return request({
    url: 'monitor_api/cmTarget/selTargetAlarmInfo?cmFlag=' + cmFlag + '&clusterFlag=' + clusterFlag,
    method: 'get'
  })
}

export function upTarget(data) {
  return request({
    url: '/monitor_api/cmTarget/upTargetAlarmInfo',
    method: 'post',
    data: data
  })
}

export function saveTarget(data) {
  return request({
    url: '/monitor_api/cmTarget/saveClusterServiceTarget',
    method: 'post',
    data: data
  })
}

export function getMap(data) {
  return request({
    url: 'monitor_api/cmTarget/selTargetDetail',
    method: 'post',
    data: data
  })
}

export function addConfig(data) {
  return request({
    url: '/monitor_api/cmTarget/insMonitorTargetConfig',
    method: 'post',
    data: data
  })
}

export function editConfig(data) {
  return request({
    url: '/monitor_api/cmTarget/upMonitorTargetConfig',
    method: 'post',
    data: data
  })
}

export function delConfig(data) {
  return request({
    url: '/monitor_api/cmTarget/delMonitorTargetConfig',
    method: 'post',
    data: data
  })
}

export function getContrast(data) {
  return request({
    url: 'monitor_api/cmServiceParam/compareServiceParamPart',
    method: 'post',
    data: data
  })
}

export function downLoad(data) {
  return request({
    url: '/monitor_api/cmServiceParam/paramDownload',
    method: 'post',
    data: data
  })
}

export function downInfo(data) {
  return request({
    url: '/monitor_api/cmServiceParam/downInfo',
    method: 'post',
    data: data,
    responseType: 'blob'
  })
}

export function getTop(data) {
  return request({
    url: 'monitor_api/cmTarget/getTopName',
    method: 'post',
    data: data
  })
}

export function getTargetDetail(data) {
  return request({
    url: 'monitor_api/cmTarget/selTargetDetailList',
    method: 'post',
    data: data
  })
}

export function getTargetTop(data) {
  return request({
    url: 'monitor_api/cmTarget/getTopNameList',
    method: 'post',
    data: data
  })
}

export function getServiceType() {
  return request({
    url: 'monitor_api/cmTarget/selServiceType',
    method: 'get'
  })
}

export function getTypeConfig(serviceType) {
  return request({
    url: 'monitor_api/cmTarget/selTypeTargetConfig?serviceType=' + serviceType,
    method: 'get'
  })
}

export function addWarn(data) {
  return request({
    url: 'monitor_api/cmTarget/addWarnSendConfig',
    method: 'post',
    data: data
  })
}

export function editWarn(data) {
  return request({
    url: 'monitor_api/cmTarget/updateWarnSendConfig',
    method: 'post',
    data: data
  })
}

export function delWarn(id) {
  return request({
    url: 'monitor_api/cmTarget/deleteWarnSendConfig?id=' + id,
    method: 'get'
  })
}

export function publishWarn(id) {
  return request({
    url: 'monitor_api/cmTarget/releaseWarnSendConfig?id=' + id,
    method: 'get'
  })
}

export function unpublishWarn(id) {
  return request({
    url: 'monitor_api/cmTarget/noReleaseWarnSendConfig?id=' + id,
    method: 'get'
  })
}

export function addUser(data) {
  return request({
    url: 'monitor_api/cmTarget/addWarningUser',
    method: 'post',
    data: data
  })
}

export function editUser(data) {
  return request({
    url: 'monitor_api/cmTarget/updateWarningUser',
    method: 'post',
    data: data
  })
}

export function delUser(id) {
  return request({
    url: 'monitor_api/cmTarget/deleteWarningUser?id=' + id,
    method: 'get'
  })
}

export function getNameList(id) {
  return request({
    url: 'monitor_api/cmTarget/selWarningUser',
    method: 'get'
  })
}

export function getParamWarn(params) {
  return request({
    url: 'monitor_api/cmServiceParam/selParamWarn',
    method: 'get',
    params
  })
}
export function getClusterService(params) {
  return request({
    url: '/monitor_api/cmTarget/selClusterService',
    method: 'get',
    params
  })
}
export function getTargetConfig(params) {
  return request({
    url: 'monitor_api/cmTarget/selMonitorTargetConfig',
    method: 'get',
    params
  })
}

export function getWarnSendConfig(params) {
  return request({
    url: 'monitor_api/cmTarget/selWarnSendConfig',
    method: 'get',
    params
  })
}

export function getWarningUserList(params) {
  return request({
    url: 'monitor_api/cmTarget/selWarningUserList',
    method: 'get',
    params
  })
}

export function getWarnSendLog(params) {
  return request({
    url: 'monitor_api/cmTarget/selWarnSendLog',
    method: 'get',
    params
  })
}

export function getTargetAlarmInfo(params) {
  return request({
    url: 'monitor_api/cmTarget/selTargetAlarmInfo',
    method: 'get',
    params
  })
}

export default { contrast, param, saveLine, getService, cluster, getChildren, getVersion, getTarget, getTable, upTarget, saveTarget, getMap, addConfig, editConfig, delConfig, getContrast, downLoad, downInfo, getTop, getTargetDetail, getTargetTop, getServiceType, getTypeConfig, addWarn, addUser, editUser, delUser, getNameList, editWarn, delWarn, publishWarn, unpublishWarn,
  getParamWarn, getClusterService, getTargetConfig, getTargetAlarmInfo, getWarnSendConfig, getWarningUserList, getWarnSendLog
}
